package scanTest;

public class ThreadMonitor implements Runnable{

	private String tName;
	private TransferFile transfer;
	public ThreadMonitor(String tName){
		this.tName=tName;
	}

	@Override
	public void run() {
		boolean flag;
		while(true){
			try {
				Thread.sleep(1000);
				transfer=new TransferFile();
				flag=transfer.copyFile(this.tName, "d:\\newFile");//复制到指定文件夹
				if(flag){//flag0代表文件传输完毕
					break;
				}
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		System.out.print(this.tName+":"+Thread.currentThread().getName()+"运行完毕");
	}
}
